package com.example.demo.Aspect;

import com.example.demo.entity.Person;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @Author : 叶荻风
 * @create : 2024/5/23 11:18
 * 原始对象
 */
public class UserServiceImpl implements UserService, ApplicationContextAware {

    private ApplicationContext applicationContext;
    public void login(String name, String password) {
        System.out.println("login");

    }
    public void register(Person person) {
        System.out.println("register");
        UserService userService =(UserService) applicationContext.getBean("userService");
        userService.login("sa","123456");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
